package com.jzoom.zoom.admin.controllers;

import com.jzoom.zoom.admin.models.UploadService;
import com.jzoom.zoom.common.annotations.Inject;
import com.jzoom.zoom.web.annotations.Controller;
import com.jzoom.zoom.web.annotations.JsonResponse;
import org.apache.commons.fileupload.FileItem;

import java.io.IOException;

@Controller(key="upload")
public class UploadController implements AdminController {

    @Inject
    private UploadService uploadService;
	
	@JsonResponse
	public String image( FileItem file ) throws IOException {
        return uploadService.doUpload(".jpg", file);

    }


    @JsonResponse
	public String jar( FileItem file ) throws IOException {
        return uploadService.doUpload(".jar", file);

    }
}
